]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
screenshot: Fall back to home if Pictures directory is not available
authorSam Uong <samuong@gmail.com>
Mon, 6 Jun 2022 10:45:25 +0000 (10:45 +0000)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 6 Jun 2022 18:54:19 +0000 (20:54 +0200)
GLib.get_user_special_dir() returns null if user directories are
disabled. Instead of failing silently, fall back to saving screenshots
in $HOME/Screenshots in that case

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5549

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2327>

js/ui/screenshot.js

index f30884c57bc7b71ee2a0adc7333cd4966b952e3c..a84cd0a44bbc8d5218a0d880ff5aaa7aee7c1f43 100644 (file)
@@ -2064,7 +2064,7 @@ function _storeScreenshot(bytes, pixbuf) {
 
     if (!disableSaveToDisk) {
         const dir = Gio.File.new_for_path(GLib.build_filenamev([
-            GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_PICTURES),
+            GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_PICTURES) || GLib.get_home_dir(),
             // Translators: name of the folder under ~/Pictures for screenshots.
             _('Screenshots'),
         ]));